"use strict"

/**
 * 中国税务政府采购网爬虫
 *  
 */


var Base = require("./base");
var ctaxccgp_spider = new Base();
ctaxccgp_spider.name = "中国税务政府采购网";
ctaxccgp_spider.encode = "GBK";

ctaxccgp_spider.getPageUrl = function (pg) {
    var url = "http://www.ctaxccgp.com.cn/swcg/zbgg/index.htm";
    if (pg != 1) {
        url = "http://www.ctaxccgp.com.cn/swcg/zbgg/index_" + pg + ".htm";
    }
    return url;
}
ctaxccgp_spider.getItems = function ($) {
    var items = [];
    $("td.txthei a.txthei").each(function (index, ele) {
        var e = $(ele);
        var item = {};
        item.title = e.text();
        var url = e.attr("href");
        url = url.substring(2);
        item.url = "http://www.ctaxccgp.com.cn/swcg/zbgg/" + url;
        item.source = ctaxccgp_spider.name;
        items.push(item);
    });
    return items;
}

exports = module.exports = ctaxccgp_spider;